﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace HW.UI.Converter
{
    public class DecimalStringConcatConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values != null && values.Length == 2 && values[0] is decimal && values[1] is string)
            {
                decimal amount = (decimal)values[0];
                string unit = (string)values[1];
                return $"{amount} {unit}";
            }
            return null; // 或者返回空字符串 ""，或者 DependencyProperty.UnsetValue，视情况而定
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
